<h3 class="h4"><%= t("decidim.system.models.organization.fields.file_upload_settings") %></h3>
<p class="help-text"><%= t(".intro") %></p>

<%= f.fields_for :file_upload_settings, f.object.file_upload_settings do |settings_form| %>
  <%= settings_form.fields_for :allowed_file_extensions, OpenStruct.new(settings_form.object.allowed_file_extensions) do |extensions_form| %>
    <% i18n_scope = "#{f.object.class.i18n_scope}.attributes.#{settings_form.object.model_name.i18n_key}.allowed_file_extensions" %>

    <%= field_set_tag f.label(t(".file_extensions.title"), nil, for: nil), class: "border-2 border-background p-4 form__wrapper" do %>
      <%= extensions_form.text_field :default, data: { controller: "input-tags" }, class: "mt-4", label: t("default", scope: i18n_scope), help_text: t(".file_extensions.default_hint") %>
      <%= extensions_form.text_field :image, data: { controller: "input-tags" }, class: "mt-4", label: t("image", scope: i18n_scope), help_text: t(".file_extensions.image_hint") %>
      <%= extensions_form.text_field :admin, data: { controller: "input-tags" }, class: "mt-4", label: t("admin", scope: i18n_scope), help_text: t(".file_extensions.admin_hint") %>
    <% end %>
  <% end %>

  <%= settings_form.fields_for :allowed_content_types, OpenStruct.new(settings_form.object.allowed_content_types) do |extensions_form| %>
    <% i18n_scope = "#{f.object.class.i18n_scope}.attributes.#{settings_form.object.model_name.i18n_key}.allowed_content_types" %>

    <%= field_set_tag f.label(t(".content_types.title"), nil, for: nil), class: "border-2 border-background p-4 form__wrapper" do %>
      <p class="help-text"><%= t(".content_types.intro_html") %></p>
      <%= extensions_form.text_field :default, data: { controller: "input-tags" }, class: "mt-4", label: t("default", scope: i18n_scope), help_text: t(".content_types.default_hint") %>
      <%= extensions_form.text_field :admin, data: { controller: "input-tags" }, class: "mt-4", label: t("admin", scope: i18n_scope), help_text: t(".content_types.admin_hint") %>
    <% end %>
  <% end %>

  <%= settings_form.fields_for :maximum_file_size, OpenStruct.new(settings_form.object.maximum_file_size) do |extensions_form| %>
    <% i18n_scope = "#{f.object.class.i18n_scope}.attributes.#{settings_form.object.model_name.i18n_key}.maximum_file_size" %>

    <%= field_set_tag f.label(t(".file_sizes.title"), nil, for: nil), class: "border-2 border-background p-4 form__wrapper last:pb-4" do %>
      <%= extensions_form.number_field :default, step: 0.1, min: 0, label: t("default", scope: i18n_scope), help_text: t(".file_sizes.default_hint") %>
      <%= extensions_form.number_field :avatar, step: 0.1, min: 0, label: t("avatar", scope: i18n_scope), help_text: t(".file_sizes.avatar_hint") %>
    <% end %>
  <% end %>
<% end %>
